﻿namespace System {
	class Math {
		static property pi { get { return 3.14159265358979; } }
		static property e { get { return 2.7182818274590; } }

		static method sin(a) {
			argmatch(NUM) return @system_math_sin;
			throw new InvalidArgumentException();
		}

		static method cos(a) {
			argmatch(NUM) return @system_math_cos;
			throw new InvalidArgumentException();
		}

		static method tan(a) {
			argmatch(NUM) return @system_math_tan;
			throw new InvalidArgumentException();
		}
		
		static method arcsin(a) {
			argmatch(NUM) return @system_math_arcsin;
			throw new InvalidArgumentException();
		}

		static method arccos(a) {
			argmatch(NUM) return @system_math_arccos;
			throw new InvalidArgumentException();
		}

		static method arctan(a, b=null) {
			argmatch(NUM, NULL) return @system_math_arctan;
			argmatch(NUM, NUM) return @system_math_arctan2;
			throw new InvalidArgumentException();
		}

		static method sqrt(a) {
			argmatch(NUM) return @system_math_sqrt;
			throw new InvalidArgumentException();
		}

		static method pow(a, b) {
			argmatch(NUM, NUM) return @system_math_pow;
			throw new InvalidArgumentException();
		}

		static method log(a) {
			argmatch(NUM) return @system_math_log;
			throw new InvalidArgumentException();
		}

		static method ln(a) {
			argmatch(NUM) return @system_math_ln;
			throw new InvalidArgumentException(); 
		}

		static method floor(a) {
			argmatch(NUM) return @system_math_floor;
			throw new InvalidArgumentException();
		}

		static method ceiling(a) {
			argmatch(NUM) return @system_math_ceiling;
			throw new InvalidArgumentException();
		}

		static method parseInt(value, defaultValue=null) {
			argmatch(STRING, NULL) { return @system_math_parseint; }
			argmatch(STRING, INTEGER) { return @system_math_tryparseint; }
			throw new InvalidArgumentException();
		}
	}
}